/*******************************************************************************
 * Copyright:   Copyright (c) 2007. Hisilicon Technologies, CO., LTD. 
 * Version:     V300R001B01  
 * Filename:    UsbDma.h
 * Description: Usb 2.0 dma controller driver header for MENTOR USB 2.0 OTG controller.
 * History:
                1.Created by Guan Hongchao on 2007/06/02
*******************************************************************************/

#ifndef __ECSUSBDMA_H__
#define __ECSUSBDMA_H__

/* Function list */
void ecsDmaInit(void);
BOOLEAN ecsDmaTransData(UINT8 bEndPointId, UINT8 *pBuf, UINT32 dwPktSize, UINT8 bMode,UCHAR *pChlIndex);
BOOLEAN ecsDmaRecvData(UINT8 bEndPointId, UINT8 *pBuf, UINT32 dwPktSize, UINT8 bMode,UCHAR *pChlIndex);
BOOLEAN ecsDmaReleaseCh(UINT32 chlIndex);


#define CHANNEL_MAX_NUM            4
#define DMA_DIR_IN   0
#define DMA_DIR_OUT    1
#define DMA_FLAG_FREE    0
#define DMA_FLAG_BUSY    1

typedef struct
{
    UCHAR bEndPointId; /* EP id to hardware */
    UCHAR bFlag;            /* if in service, then 1 */
    UCHAR bDirection;    /*0 for TX and 1 for RX*/
    void *dwAddress;     /*DMA souce addr for TX and dest addr for RX*/
    UINT32 uLen;            /*DMA transfer length*/
    UCHAR* pData;         /*dma data buffer*/
} S_CHANNEL, *pS_CHANNEL;

#endif

